package com.zb.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.entity.ZjRole;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/25 0025
 **/
@Data
@ApiModel("角色列表实体封装")
public class RolesVo {
    @ApiModelProperty(value = "主健ID")
    private Long id;

    @ApiModelProperty(value = "角色名称")
    private String name;

    @ApiModelProperty(value = "角色编码")
    private String code;

    @ApiModelProperty(value = "是否系统超管：false-不是，true-是")
    private Boolean admin;

    @ApiModelProperty(value = "角色状态：false-正常，true-禁用")
    private Boolean status;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public static RolesVo beanToVo(ZjRole role) {
        RolesVo vo = new RolesVo();
        BeanUtils.copyProperties(role, vo);
        vo.setStatus(role.getDisabled());
        vo.setCreateTime(role.getGmtCreate());
        vo.setUpdateTime(role.getGmtUpdate());
        return vo;
    }
}
